/*
 *  Class name: DialogWindowsHandler.java
 *  Version: 1.0
 *  Date: 4.6.2014
 */
package cz.muni.fi.pv168.addressbook.gui.utils;

import cz.muni.fi.pv168.addressbook.entities.Person;
import cz.muni.fi.pv168.addressbook.gui.DetailDialogWindow;
import java.awt.Window;

/**
 *
 * @author Michal Ďuriš
 */
public class DialogWindowsHandler {

    private DialogWindowsHandler() {

    }

    public static void changeLanguageInAllDialogWindows() {

        for (Window window : Window.getWindows()) {

            if (window instanceof DetailDialogWindow) {
                DetailDialogWindow detailDialogWindow = (DetailDialogWindow) window;
                detailDialogWindow.changeLanguageInApplication();
            }
        }
    }

    public static void closeAllDialogWindowsOfPerson(Person person) {

        for (Window window : Window.getWindows()) {

            if (window instanceof DetailDialogWindow) {
                DetailDialogWindow detailDialogWindow = (DetailDialogWindow) window;

                if (detailDialogWindow.isDialogWindowOfPerson(person)) {
                    detailDialogWindow.dispose();
                }
            }
        }
    }

}
